package com.huaweicloud.saaslanding.install.properties;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

import com.huaweicloud.saaslanding.install.constant.ModelConstant;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Component
@RefreshScope
@ConfigurationProperties(prefix = ModelConstant.EMAIL_INFO_PREFIX)
public class Email {
    private String host;
    private String username;
    private String password;

    // 发件人邮箱
    private String senderEmail;

    // 发件人姓名
    private String senderName;

    // Minimum interval seconds between two request
    private Integer minInterval = 60;
    private Integer maxRequestPerDay = 20;
    private Map<Sms.NotificationEvent, EmailData> notificationEvents = new ConcurrentHashMap<>();

    @Getter
    @Setter
    public static class EmailData {
        private String subject;
        private String body;
    }
}
